<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        function sayName(){
            console.log(this.name)
        }

        //构造一个创建人的类
        function Person(name , age , gender){
            console.log('指向:',this);
            this.name = name;
            this.age = age ;
            this.gender = gender;
            this.sayName = sayName;
        }

        //构造一个创建狗的类
        function Dog(name , age ){
            console.log('指向:',this);
            this.name = name;
            this.age = age ;
            this.sayHello = function(){
                console.log('汪汪汪~~');
            }
        }

        //创建一个人的实例
        var per = new Person('苏凉',21,'男');
        var per1 = new Person('小红',18,'女');
        console.log(per);
        per.sayName();
        per1.sayName();
        console.log(per.sayName == per1.sayName);

        //创建一个狗的实例
        var dog = new Dog('旺财',5);
        var dog1 = new Dog('来福',3)
        console.log(dog);
        dog.sayHello();
        console.log(dog.sayHello==dog1.sayHello);

        console.log()

        // console.log(dog instanceof Dog); //true
        // console.log(dog instanceof Person); //false
        // console.log(dog instanceof Object); //true
    </script>
</head>
<body>
    
</body>
</html>